import axios from 'axios'
// import NproGress from 'nprogress'
// 二次封装axios

// axios.defaults.baseURL  设置请求公共路径
import { authWhiteList } from './whitelist' 
axios.defaults.baseURL = "http://8.130.109.249:8083"

axios.interceptors.request.use((config) => {
    console.log(config)
    authWhiteList.forEach(item => {
        if (item === config.url) {
            // config.headers.Authorization   token信息
            const token = localStorage.getItem('token') ? localStorage.getItem('token') : ''
            config.headers.Authorization = token
            
        }
    })
    return config
})

axios.interceptors.response.use((data) => {
    console.log(234)
    const { status } = data;
    // console.log(data);
    
    return data
})

export default axios